using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class UF_FormMap : EntityTypeConfiguration<UF_Form>
    {
        public UF_FormMap()
        {
            // Primary Key
            this.HasKey(t => t.id);

            // Properties
            this.Property(t => t.id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.RecordID)
                .IsRequired()
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("UF_Form");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.FormType).HasColumnName("FormType");
            this.Property(t => t.RecordID).HasColumnName("RecordID");
            this.Property(t => t.CreatedBy).HasColumnName("CreatedBy");
            this.Property(t => t.CreatedOn).HasColumnName("CreatedOn");
            this.Property(t => t.UF_Closed).HasColumnName("UF_Closed");

            // Relationships
            this.HasRequired(t => t.UF_FormType)
                .WithMany(t => t.UF_Form)
                .HasForeignKey(d => d.FormType);

        }
    }
}
